<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>1.天气案例</title>
    <script src="../js/vue.min.js"></script>
</head>

<body>
    <div id="root">
        <h2>天气很 {{weather}} </h2>
        <button @click="isHot = !isHot">切换天气</button>

    </div>

    <script type="text/javascript">
        new Vue({
            el: '#root',
            data() {
                return {
                    isHot: true
                }
            },
            methods: {
              /*   changeWeather() {
                    this.isHot = !this.isHot;
                } */
            },
            computed: {
                weather() {
                    return this.isHot ? '炎热' : '凉爽';
                }
            }
        });
    </script>

</body>

</html>